<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>createlang</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="REFENTRY">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="app-createdb.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="app-createdb.html">快退</a></td><td width="60%" align="center" valign="bottom"></td><td width="10%" align="right" valign="top"><a href="app-createuser.html">快进</a></td><td width="10%" align="right" valign="top"><a href="app-createuser.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<h1><a name="APP-CREATELANG"></a><span class="APPLICATION">createlang</span></h1>
<div class="REFNAMEDIV"><a name="AEN55765"></a><h2>名称</h2>createlang&nbsp;--&nbsp;定义一个新过程语言</div>
<a name="AEN55769"></a>
<div class="REFSYNOPSISDIV"><a name="AEN55771"></a><h2>语法</h2>
<p><tt class="COMMAND">createlang</tt> [<tt class="REPLACEABLE"><i>connection-option</i></tt>...]  <tt class="REPLACEABLE"><i>langname</i></tt>  [<tt class="REPLACEABLE"><i>dbname</i></tt>]<br><tt class="COMMAND">createlang</tt> [<tt class="REPLACEABLE"><i>connection-option</i></tt>...]  --list | -l   <tt class="REPLACEABLE"><i>dbname</i></tt></p>
</div>
<div class="REFSECT1"><a name="AEN55789"></a><h2>描述</h2>
<p><span class="APPLICATION">createlang</span> 是一个用于向数据库中增加新编程语言的工具。<span class="APPLICATION">createlang</span> 只是一个 <a href="sql-createlanguage.html"><i>CREATE LANGUAGE</i></a> 命令的封装，参阅该命令获取更多信息。</p>
</div>
<div class="REFSECT1"><a name="AEN55796"></a><h2>选项</h2>
<p><span class="APPLICATION">createlang</span> 接受下列命令行参数：</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="REPLACEABLE"><i>langname</i></tt></dt>
<dd><p>要被定义的过程编程语言的名称</p></dd>
<dt><tt class="OPTION">[<span class="OPTIONAL">-d</span>] <tt class="REPLACEABLE"><i>dbname</i></tt></tt><br><tt class="OPTION">[<span class="OPTIONAL">--dbname</span>] <tt class="REPLACEABLE"><i>dbname</i></tt></tt></dt>
<dd><p>指定要向哪个数据库增加该语言。缺省使用和当前系统用户同名的数据库。</p></dd>
<dt><tt class="OPTION">-e</tt><br><tt class="OPTION">--echo</tt></dt>
<dd><p>显示所执行的 SQL 命令</p></dd>
<dt><tt class="OPTION">-l</tt><br><tt class="OPTION">--list</tt></dt>
<dd><p>显示一个在目标数据库里已经安装的语言的列表</p></dd>
</dl>
</div>
<p><span class="APPLICATION">createlang</span> 还接受下列命令行参数作为连接参数：</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="OPTION">-h <tt class="REPLACEABLE"><i>host</i></tt></tt><br><tt class="OPTION">--host <tt class="REPLACEABLE"><i>host</i></tt></tt></dt>
<dd><p>指定运行服务器的主机名。如果数值以斜杠开头，则被用做到 Unix 域套接字的路径。</p></dd>
<dt><tt class="OPTION">-p <tt class="REPLACEABLE"><i>port</i></tt></tt><br><tt class="OPTION">--port <tt class="REPLACEABLE"><i>port</i></tt></tt></dt>
<dd><p>指定服务器侦听的 TCP 端口或一个本地 Unix 域套接字文件的扩展(描述符)</p></dd>
<dt><tt class="OPTION">-U <tt class="REPLACEABLE"><i>username</i></tt></tt><br><tt class="OPTION">--username <tt class="REPLACEABLE"><i>username</i></tt></tt></dt>
<dd><p>进行连接的用户名</p></dd>
<dt><tt class="OPTION">-W</tt><br><tt class="OPTION">--password</tt></dt>
<dd><p>强制口令提示符</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN55868"></a><h2>环境变量</h2>
<div class="VARIABLELIST">
<dl>
<dt><tt class="ENVAR">PGDATABASE</tt><br><tt class="ENVAR">PGHOST</tt><br><tt class="ENVAR">PGPORT</tt><br><tt class="ENVAR">PGUSER</tt></dt>
<dd><p>缺省连接参数</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN55882"></a><h2>诊断</h2>
<p>多数错误信息都是自解释的。如果不是，使用 <tt class="OPTION">--echo</tt> 选项运行 <span class="APPLICATION">createlang</span> 然后针对相应的 SQL 命令检查细节。</p>
</div>
<div class="REFSECT1"><a name="AEN55888"></a><h2>注意</h2>
<p>使用 <a href="app-droplang.html"><span class="APPLICATION">droplang</span></a> 删除一种语言。</p>
</div>
<div class="REFSECT1"><a name="AEN55892"></a><h2>例子</h2>
<p>把 <tt class="LITERAL">pltcl</tt> 语言安装到数据库 <tt class="LITERAL">template1</tt> 里：</p>
<pre class="SCREEN"><samp class="PROMPT">$ </samp><kbd class="USERINPUT">createlang pltcl template1</kbd></pre>
<p>注意，安装到 <tt class="LITERAL">template1</tt> 中的语言将自动安装到随后创建的其他数据库中。</p>
</div>
<div class="REFSECT1"><a name="AEN55901"></a><h2>又见</h2><a href="app-droplang.html"><span class="APPLICATION">droplang</span></a>, <a href="sql-createlanguage.html"><i>CREATE LANGUAGE</i></a>, 环境变量(<a href="http://www.jinbuguo.com/postgresql/manual/libpq-envars.html">节29.12</a>)</div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="app-createdb.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="app-createuser.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top"><span class="APPLICATION">createdb</span></td><td width="34%" align="center" valign="top"><a href="reference-client.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top"><span class="APPLICATION">createuser</span></td></tr>
</table>
</div>
</body></html>